﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace Sexybeauty.Core.Inf.Entities.Table
{
    [Table("Member")]
    public class Member : BaseEntity<Member>
    {
        public override Member Get(System.Linq.Expressions.Expression<Func<Member, bool>> where)
        {
            using (Context ctx = new Context())
            {
                var item = ctx.Member.FirstOrDefault(where);
                if (item != null)
                {
                    this.UserName = item.UserName;
                    this.NickName = item.NickName;
                    this.Password = item.Password;
                    this.Gender = item.Gender;
                    this.Birthday = item.Birthday;
                    this.Role = item.Role;
                    this.Area = item.Area;
                    this.Location = item.Location;
                    this.QQ = item.QQ;
                    this.Phone = item.Phone;
                    this.Email = item.Email;
                    this.RcdDate = item.RcdDate;
                    this.IsRefuse = item.IsRefuse;
                    this.Token = item.Token;
                    this.IsActivate = item.IsActivate;
                }
                return this;
            }
        }

        [Column(TypeName="nvarchar")]
        [StringLength(45)]
        [Key]
        public string UserName { get; set; }

        [Column(TypeName="nvarchar")]
        [StringLength(45)]
		public string NickName{get;set;}
		
        [Column(TypeName="nvarchar")]
        [StringLength(45)]
        public string Password { get; set; }

        [Column(TypeName="bit")]
        public bool Gender { get; set; }

        [Column(TypeName="datetime")]
        public DateTime Birthday { get; set; }

        [Column(TypeName="int")]
        public int Role { get; set; }
		
		[Column(TypeName="int")]
		public int Area{get;set;}
		
		[Column(TypeName="int")]
		public int Location{get;set;}
		
		[Column(TypeName="varchar")]
		[StringLength(45)]
		public string QQ{get;set;}
		
		[Column(TypeName="varchar")]
		[StringLength(45)]
		public string Phone{get;set;}
		
		[Column(TypeName="varchar")]
		[StringLength(200)]
		public string Email{get;set;}
		
		[Column(TypeName="datetime")]
		public DateTime RcdDate{get;set;}
		
		[Column(TypeName="bit")]
		public bool IsRefuse{get;set;}

        [Column(TypeName="bit")]
        public bool IsActivate { get; set; }

        [Column(TypeName="varchar")]
        public string Token { get; set; }
    }
}
